<?php
/**
 * Description of IndexView
 *
 * @author Animus Inc.
 */
// Restrict Unrestricted Access

defined("_dispatch") or	die("Access Denied !");

// Constants

define('DOMROOT', dirname(dirname(__FILE__)));

// Imports
require_once DOMROOT.'/dependencies/lib/Twig/Autoloader.php';
require_once DOMROOT.'/classes/abstract/View.php';

class TestView extends View{
    
    private $_attributes;
    
    public function __construct() {
        Twig_Autoloader::register();// Starting and configuring the Twig templating engine
        $loader = new Twig_Loader_Filesystem(DOMROOT.'/templates');
        $twig = new Twig_Environment($loader, array('cache' => DOMROOT.'/compilation_cache','auto_reload' => TRUE ));
        $this -> _template = $twig ->loadTemplate('adminmain.html');
        return true;;
    }
    public function output() {
            echo "Test View Loaded !";
        if(isset($this->_attributes["_fname"])) $fname = $this -> _attributes["_fname"];
        else $fname = "Guest";
        $this->_template -> display(array(
                                     'pageTitle' => 'Stockworldmarket - Admininstration',
                                     'pageHeading' => "Admin",
                                     '_fname' =>  $fname,
                                     '_lname' => $this -> _attributes["_lname"],
                                     'menubar' => '<a href="/stockworldmarket/new-user/register.php">Register</a>
                                              <a href="/stockworldmarket/admin/">Admin Login</a>
                                                <a href="http://localhost/stockworldmarket/test/">Test</a>',
                                     'logout' => "logout.php"
                                     
                                     ));
        return true;
    }
    public function setViewData($attributes){
        $this->_attributes = $attributes;
        return true;
    }
    
    public function getViewData(){
        return $this->_attributes;
    }
}

?>